home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 31
/
Amiga Format CD31 (1998-09-02)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1998-10].iso
/
-websites-
/
sasg
/
dfa
/
rexx
/
importadm.lzh
/
importadm.dfa
Wrap
Text File
|
1996-06-16
|
7KB
|
236 lines
/* $Revision Header built automatically *************** (do not edit) ************
**
** © Copyright by Dirk Federlein
**
** File : importadm.dfa
** Created on : Friday, 01.04.94 12:29:21
** Created by : Dirk Federlein
** Current revision : V3.0
**
**
** Purpose
** -------
**
** If you've used ADM (what a shame:-)) up to now to manage
** your addresses, this script will help you to switch to DFA
** without loosing any data or even reentering all of your
** addresses!
**
** It imports all addresses currently available from a running
** ADM application.
**
**
** This script should be bound to a function key of DFA, but
** will work as well, if you start it from the shell using the
** 'rx' command of Arexx, i.e. 'rx importadm.dfa'. Of course, you
** have to make sure that DFA _and_ ADM are running!
**
** Please note that it is not possible to import the addresses
** 1:1 as not all fields exist in ADM _and_ DFA. The following
** translation is made:
**
** -------------------------------------------------------------
** ADM --> DFA
** --- ===
** SALUTATION + COMPANY SALUTATION
** REMARK1 COMMENT
** COMPANY EMAIL3
** ADDRESS Line # 1 STREET
** ADDRESS Line # 2 CO
** ID <empty>
** <empty> STATE
** -------------------------------------------------------------
**
** The other strings are taken 1:1
**
** Please notice that the <empty> strings above means that either
** ADM or DFA does not support this field and it is not imported
** into DFA,
** Of course you may modify the translation described
** above to fit you needs.
**
** Group flags 1-8 of ADM are put into DFA. Flags 9 and 10 of ADM
** are not imported.
**
**
** Revision V3.0
** --------------
** created on Sonntag, 28.01.96 13:20:32 by Dirk Federlein. LogMessage :
** - Change to make it compatible to ADM 2.03
** - country is supported
** - new group flags handling (ADM)
** - company is imported
** - ext files are tried to be imported
**
** Revision V2.0
** --------------
** created on Friday, 01.04.94 12:29:21 by Dirk Federlein. LogMessage :
** --- Initial release ---
**
*********************************************************************************/
options results
cr = '0A'X
quote = '22'X
quote2 = '27'X
if ~show(ports, DFA) then
exit 10
if ~show(ports, ADM.1) then
exit 20
/*
* DISABLE DFA GUI
*/
ADDRESS 'DFA' GUI INPUT OFF OUTPUT OFF
/*
* DISABLE ADM GUI
*/
ADDRESS 'ADM.1' LOCKGUI
/* --- ADM: Get number of addresses available ----------------------- */
ADDRESS 'ADM.1' ADDRINMEM
numadr = RESULT
/* --- ADM: Activate first entry ------------------------------------ */
ADDRESS 'ADM.1' ACTIVATEFIRST
DO FOR numadr
/*
* ADM: Get current address and put it into 'ADMADDRESS'
*/
ADDRESS 'ADM.1' GETADDRESS ADMADDRESS
/*
* Handling of group flags has changed in "newer" ADM versions. I've
* adopted and tested it using the (public) version of ADM 2.03.
* If it does not work with your ADM version, try to get the latest ADM
* version and try again.
* Notice: Due to the fact that DFA handles up to 8 groups, ADM's groups
* #9 and #10 are lost while converting to DFA.
*/
FLAGSTRING = ""
ALLFLAGS = ADMADDRESS.FLAGS
groupset = index(ALLFLAGS, 'A')
if groupset > 0 then
FLAGSTRING = FLAGSTRING 'GROUP1'
groupset = index(ALLFLAGS, 'B')
if groupset > 0 then
FLAGSTRING = FLAGSTRING 'GROUP2'
groupset = index(ALLFLAGS, 'C')
if groupset > 0 then
FLAGSTRING = FLAGSTRING 'GROUP3'
groupset = index(ALLFLAGS, 'D')
if groupset > 0 then
FLAGSTRING = FLAGSTRING 'GROUP4'
groupset = index(ALLFLAGS, 'E')
if groupset > 0 then
FLAGSTRING = FLAGSTRING 'GROUP5'
groupset = index(ALLFLAGS, 'F')
if groupset > 0 then
FLAGSTRING = FLAGSTRING 'GROUP6'
groupset = index(ALLFLAGS, 'G')
if groupset > 0 then
FLAGSTRING = FLAGSTRING 'GROUP7'
groupset = index(ALLFLAGS, 'H')
if groupset > 0 then
FLAGSTRING = FLAGSTRING 'GROUP8'
/*
* ADM's comment may be more than one line, i.e. a newline is allowed
* in ADM's comment field as well as chars used by Arexx like ", ', ...
* Filter it out...
*/
NEWREMARK = translate(ADMADDRESS.REMARK1, ";", (cr) )
NEWREMARK = translate(NEWREMARK, "*", quote)
NEWREMARK = translate(NEWREMARK, "*", quote2)
say NEWREMARK
/*
* DFA: Insert new address
*
* NB: ADM has several fields DFA hasn't and vice versa. Due to this fact I try
* to find another solution for all fields with no "exact match".
* * ADM's title field is put into the salutation field additionally.
* * ADM's company field is stored into DFA's email #3
* * DFA's state field is not used (ADM has no similar field)
*
* External file handling via Arexx is a bit tricky! ADM returns a filename
* and DFA expects the file _contents_, as the filename is generated automatically.
* If the import of the external files does not work as expected, please
* put comment the foolowing block "out".
*
*/
exttext = ""
say ADMADDRESS.EXTFILE
if ADMADDRESS.EXTFILE ~= "" then
do
if open('admext', ADMADDRESS.EXTFILE, 'R') ~= 0 then
do
exttext = readch('admext', 65535)
end
if exttext ~= "" then
do
ADDRESS 'DFA' 'NEW' 'SALUTATION='quote||ADMADDRESS.SALUTATION ADMADDRESS.TITLE||quote 'NAME='quote||ADMADDRESS.LASTNAME||quote 'FIRST='quote||ADMADDRESS.FIRSTNAME||quote 'CO='quote||ADMADDRESS.ADDRESS2||quote 'STREET='quote||ADMADDRESS.ADDRESS1||quote 'ZIP='quote||ADMADDRESS.POSTCODE||quote 'CITY='quote||ADMADDRESS.CITY||quote 'COUNTRY='quote||ADMADDRESS.COUNTRY||quote 'BIRTHDAY='quote||ADMADDRESS.BIRTHDAY||quote 'PHONE='quote||ADMADDRESS.TELEPHONE||quote 'FAX='quote||ADMADDRESS.FAX||quote 'EMAIL1='quote||ADMADDRESS.EMAIL1||quote 'EMAIL2='quote||ADMADDRESS.EMAIL2||quote 'EMAIL3='quote||ADMADDRESS.COMPANY||quote 'COMMENT='quote||NEWREMARK||quote 'EXTERNAL='quote||exttext||quote FLAGSTRING
end
end
else
do
ADDRESS 'DFA' 'NEW' 'SALUTATION='quote||ADMADDRESS.SALUTATION ADMADDRESS.TITLE||quote 'NAME='quote||ADMADDRESS.LASTNAME||quote 'FIRST='quote||ADMADDRESS.FIRSTNAME||quote 'CO='quote||ADMADDRESS.ADDRESS2||quote 'STREET='quote||ADMADDRESS.ADDRESS1||quote 'ZIP='quote||ADMADDRESS.POSTCODE||quote 'CITY='quote||ADMADDRESS.CITY||quote 'COUNTRY='quote||ADMADDRESS.COUNTRY||quote 'BIRTHDAY='quote||ADMADDRESS.BIRTHDAY||quote 'PHONE='quote||ADMADDRESS.TELEPHONE||quote 'FAX='quote||ADMADDRESS.FAX||quote 'EMAIL1='quote||ADMADDRESS.EMAIL1||quote 'EMAIL2='quote||ADMADDRESS.EMAIL2||quote 'EMAIL3='quote||ADMADDRESS.COMPANY||quote 'COMMENT='quote||NEWREMARK||quote FLAGSTRING
end
/* --- ADM: Next entry ------------------------------------------ */
ADDRESS 'ADM.1' ACTIVATENEXT
END
/*
* Reactivate ADM GUI
*/
ADDRESS 'ADM.1' UNLOCKGUI
/*
* Reactive DFA-GUI
*/
ADDRESS 'DFA' GUI INPUT ON OUTPUT ON
EXIT